<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>销售详情</title>
    <link rel="stylesheet" type="text/css" href="../css/login.css">
    <script src="https://cdn.bootcss.com/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="../js/config.js"></script>
    <script type="text/javascript" src="../js/vue.js"></script>
    <script type="text/javascript" src="../js/filter.js"></script>
  </head>
  <body>
    <form class="carSale-form" id="carSaleForm" >
        <div class="panel" v-if="carSale.length > 0">
            <div class="box">
                <div class="title">基本信息</div>
                <div class="box">
                    <div class="cell-car">
                        <label>销售类型</label>
                        <input type="" name="saleType" :value="carSale[0].saleType | filterSaleType"  disabled>
                    </div>
                    <div class="cell-car">
                        <label>成交日期</label>
                        <input type="" name="saleDealDate" :value="carSale[0].saleDealDate | filterGetDateForDay"  disabled>
                    </div>
                    <div class="cell-car">
                        <label>付款类型</label>
                        <input type="" name="salePayType" :value="carSale[0].salePayType | filterSalePayType"  disabled>
                    </div>
                    <div class="cell-car">
                        <label>是否代办保险</label>
                        <input type="" name="saleInsuranceState" :value="carSale[0].saleInsuranceState | filterSaleInsuranceState"  disabled>
                    </div>
                    <div class="cell-car">
                        <label>成交员工</label>
                        <input type="" name="userName" v-model="carSale[0].user.userName"  disabled>
                    </div>
                </div>
                <div class="box">
                    <div class="cell-car">
                        <label>所属省份</label>
                        <input type="" name="provinceName" v-model="carSale[0].province.provinceName"  disabled>
                    </div>
                    <div class="cell-car">
                        <label>所属城市</label>
                        <input type="" name="cityName" v-model="carSale[0].city.cityName"  disabled>
                    </div>
                    <div class="cell-car" v-if="channelList.length>0">
                        <label>所属渠道</label>
                        <input type="" name="channelName" v-model="channelList[0].channelName"  disabled>
                    </div>
                </div>

                <div class="title">费用信息</div>
                <div class="box">
                    <div class="group-input">
                        <label>成交价格</label>
                        <input type="" name="salePrice" v-model="carSale[0].salePrice"  disabled>
                        <span>万元</span>
                    </div>
                    <div class="group-input">
                        <label>佣金</label>
                        <input type="" name="saleCommission" v-model="carSale[0].saleCommission"  disabled>
                        <span>元</span>
                    </div>
                    <div class="group-input">
                        <label>定金</label>
                        <input type="" name="saleDeposit" v-model="carSale[0].saleDeposit"  disabled>
                        <span>元</span>
                    </div>
                    <div class="group-input">
                        <label>余款</label>
                        <input type="" name="saleBalance" v-model="carSale[0].saleBalance"  disabled>
                        <span>元</span>
                    </div>
                </div>
                <div class="box">
                    <div class="group-input">
                        <label>首付款</label>
                        <input type="" name="saleFirstPayment" v-model="carSale[0].saleFirstPayment"  disabled>
                        <span>万元</span>
                    </div>
                    <div class="group-input">
                        <label>过户费用</label>
                        <input type="" name="saleTransferFee" v-model="carSale[0].saleTransferFee"  disabled>
                        <span>元</span>
                    </div>
                    <div class="group-input">
                        <label>开票费用</label>
                        <input type="" name="saleBillPrice" v-model="carSale[0].saleBillPrice"  disabled>
                        <span>元</span>
                    </div>
                    <div class="group-input">
                        <label>其它费用</label>
                        <input type="" name="saleOtherPrice" v-model="carSale[0].saleOtherPrice"  disabled>
                        <span>元</span>
                    </div>
                </div>

                <div class="title" v-if="carSale[0].salePayType == 2">按揭信息</div>
                <div class="box" v-if="carSale[0].salePayType == 2">
                    <div class="cell-car">
                        <label>按揭公司</label>
                        <input type="" name="saleMortgageName" v-model="carSale[0].saleMortgageName"  disabled>
                    </div>
                    <div class="cell-car">
                        <label>贷款额度</label>
                        <input type="" name="saleLoanLimit" v-model="carSale[0].saleLoanLimit"  disabled>
                    </div>
                    <div class="cell-car">
                        <label>按揭周期</label>
                        <input type="" name="saleMortgageCycle" v-model="carSale[0].saleMortgageCycle"  disabled>
                    </div>
                    <div class="cell-car">
                        <label>按揭费用</label>
                        <input type="" name="saleMortgagePrice" v-model="carSale[0].saleMortgagePrice"  disabled>
                    </div>
                    <div class="cell-car">
                        <label>按揭押金</label>
                        <input type="" name="saleMortgageDeposit" v-model="carSale[0].saleMortgageDeposit"  disabled>
                    </div>
                </div>

                <div class="title">买家信息</div>
                <div class="box">
                    <div class="cell-car">
                        <label>买家电话</label>
                        <input type="" name="saleBuyerMobile" v-model="carSale[0].saleBuyerMobile"  disabled>
                    </div>
                    <div class="cell-car">
                        <label>买家名称</label>
                        <input type="" name="saleBuyerName" v-model="carSale[0].saleBuyerName"  disabled>
                    </div>
                    <div class="cell-car">
                        <label>买家证件号</label>
                        <input type="" name="saleBuyerCardNo" v-model="carSale[0].saleBuyerCardNo"  disabled>
                    </div>
                </div>

                <div class="title" v-if="carSale[0].saleInsuranceState == 1">保险信息</div>
                <div class="box" v-if="carSale[0].saleInsuranceState == 1">
                    <div class="cell-car">
                        <label>保险公司</label>
                        <input type="" name="saleInsuranceCompany" v-model="carSale[0].saleInsuranceCompany"  disabled>
                    </div>
                    <div class="cell-car">
                        <label>交强险金额</label>
                        <input type="" name="saleForceInsurPrice" v-model="carSale[0].saleForceInsurPrice"  disabled>
                    </div>
                    <div class="cell-car">
                        <label>商业险金额</label>
                        <input type="" name="saleBusinessInsurPrice" v-model="carSale[0].saleBusinessInsurPrice"  disabled>
                    </div>
                </div>

                <div class="title">其它信息</div>
                <div class="box">
                    <div class="cell-car">
                        <label>备注信息</label>
                        <input type="" name="saleRemark" v-model="carSale[0].saleRemark" style="width:800px;height:100px" disabled>
                    </div>
                </div>

                <div class="btn-box">
                    <div class="cancel" onclick="goBack()">关闭</div>
                </div>
            </div>
        </div>
    </form>
  </body>
  <script type="text/javascript">
      var vm = new Vue({
          el:'#carSaleForm',
          data(){
              return {
                  channelList:[],
                  carSale: [],
                  carId:'',
              }
          },
          mounted(){
              this.ajax1()
          },
          methods:{
              ajax1(){
                  var _this = this;
                  this.carId = sessionStorage.getItem('carId')
                  $.ajax({
                      type: "get",      //data 传送数据类型。post 传递
                      dataType: 'json',  // 返回数据的数据类型json
                      url: defaultUrl+"/controller/getCarSaleList",  // yii 控制器/方法
                      cache: false,
                      data: {'carId': _this.carId},  //传送的数据
                      error:function(){
                          alert("数据传输错误");
                      },success: function (data) {
                          console.log(data);
                          if (data.code != 1) {
                              return false;
                          }
                          _this.carSale = data.result;
                          if (data.result.length>0) {
                            var channelId = (data.result)[0].channelId;
                            _this.ajax2(channelId)
                          }else{
                            alert('该车辆没有销售信息')
                            window.history.go(-1);
                          }
                      }
                  });
              },
              ajax2(channelId){
                  var _this = this;
                  $.ajax({
                      type: "get",      //data 传送数据类型。post 传递
                      dataType: 'json',  // 返回数据的数据类型json
                      url: defaultUrl + "/crm-web/controller/sysParam/channel-list",  // yii 控制器/方法
                      cache: false,
                      data: {'channelId': channelId},  //传送的数据
                      error:function(){
                          alert("数据传输错误");
                      },success: function (data1) {
                          console.log(data1);
                          if (data1.code != 1) {
                              return false;
                          }
                          _this.channelList = data1.result;
                      }
                  });
              }

          }
      });

      function goBack(){
          // window.history.go(-1);
          parent.closeTab(vm.carId);
      }


  </script>

</html>


































